Add Spring Boot sample application for testing failover scenarios#109
Open
vlsi wants to merge 9 commits intoNetcracker:mainfrom
Open
Add Spring Boot sample application for testing failover scenarios#109vlsi wants to merge 9 commits intoNetcracker:mainfrom
vlsi wants to merge 9 commits intoNetcracker:mainfrom
Conversation
Previously, ProcessCreds() was called before reconcilePatroniCoreCluster(), causing the operator to crash when trying to execute SQL on a non-existent database during initial bootstrap. This resulted in: - Nil pointer dereference at pkg/client/client.go:90 - "context deadline exceeded" errors during helm deployments - No PostgreSQL StatefulSets being created Now ProcessCreds() is called after the cluster is successfully created, allowing proper bootstrap of new PostgreSQL clusters. Also updated helmfile chart paths from ./charts/ to ./operator/charts/ to match the new repository structure after rebase. Fixes: Initial cluster bootstrap failure
Add comprehensive test to validate operator doesn't crash during cluster
bootstrap when credentials are changed before the database exists.
Test Scenario:
1. Starts with a running Kubernetes cluster and operator
2. Creates postgres-credentials-old secret (backup copy)
3. Patches postgres-credentials with new password
4. Forces operator reconciliation via CR annotation
5. Monitors for StatefulSet creation (proves cluster bootstrap succeeded)
6. Validates operator health (no crashes/restarts)
7. Checks operator logs for panic/nil pointer errors
This test would FAIL with the old code where ProcessCreds() was called
before reconcilePatroniCoreCluster(), causing nil pointer dereference
when trying to execute ALTER ROLE on non-existent database.
How to Run:
PGSSLMODE=disable INTERNAL_TLS_ENABLED=false \
robot -i check_operator_bootstrap tests/robot/check_installation/
Test Features:
- Idempotent: automatically cleans up postgres-credentials-old
- Robust: retries log retrieval if pod is in transitional state
- Clear output: BDD-style Given/When/Then structure with checkmarks
Replace LISTEN_ADDR (pod IP) with POD_DNS_NAME (DNS FQDN) for Patroni
REST API and PostgreSQL connect addresses to enable stable addressing
across pod restarts.
Changes:
- Add POD_NAME, HEADLESS_SERVICE, and POD_DNS_NAME environment variables
to Patroni StatefulSet pods
- Create patroni-headless Service for DNS-based pod discovery
- Update patroni.config.yaml to use ${POD_DNS_NAME} for pod_ip,
connect_address (PostgreSQL), and connect_address (REST API)
- Register patroni-headless service creation in reconciler
Reasons:
- Pod IPs are ephemeral and change on restarts, causing connection issues
- DNS names (pod-name.service.namespace.svc.cluster.local) are stable
- Improves reliability of Patroni DCS registration and cluster communication
- Aligns with Kubernetes best practices for StatefulSet networking
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
…arse Previously, a generic panic was logged, so it was hard to figure out the cause
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The PR adds helmfile configuration which deploys pgskipper and a sample application to verify connectivity and failover behavior.
Here's what I get with macOS + OrbStack: